<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>{maccms:name} - 新用户注册</title>
<meta name="keywords" content="{maccms:keywords}"/>
<meta name="description" content="{maccms:description}"/>
<link href="{maccms:path}template/user/css/base.css" type="text/css" rel="stylesheet"/>
<link href="{maccms:path}template/user/css/qirebox.css" type="text/css" rel="stylesheet"/>
<script>var SitePath='{maccms:path}',SiteAid='{maccms:siteaid}',SiteTid='{maccms:sitetid}',SiteId='{maccms:siteid}';</script>
<script src="{maccms:path}js/jquery.js"></script>
<script src="{maccms:path}js/common.js"></script>
<script type="text/javascript">
function remote_check(t,s){
  var url="index.php?m=user-regcheck-t-"+t+"-s-"+s;
  var ret;
  $.ajax({'url':url,'async':false,'dataType':'json','success':function(data){ret=data;}});
  return ret.res;
}
var validator={
'u_name':[
  [/\S+/, '请输入用户名'],
  [/\S{4,}/, '用户名少于4位'],
  [function(u_name){return remote_check('u_name',u_name);}, '此用户名已被使用']
],
'u_password1':[
  [/^.+$/, '请输入密码'],
  [/^.{6,}$/, '密码少于6位']
],
'u_password2':[
  [/^.+$/, '请输入确认密码'],
  [function(s){return s==$('#item_u_password1 input').val();}, '两次密码输入不一致']
],
'u_email':[
  [/\S+/, '请输入电子邮件'],
  [/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i, '请输入格式正确的电子邮件'],
  [function(u_email){return remote_check('u_email',u_email)}, '此电子邮件已被使用']
],
'u_code':[
  [/\S+/,'请输入验证码'],
  [function(u_code){return remote_check('u_code',u_code)}, '验证码不正确']
]
};

function validate(item) {
  var str=$("#item_"+item+" input").val();
  var m={
    'RegExp':function(r,s){
      return r.test(s);
    },
    'Function':function(f,s){
      return f(s);
    },
    'String':function(v,s){return v==s;}
  };
  for (var v in validator[item]) {
    var vi=validator[item][v];
    var c=Object.prototype.toString.apply(vi[0]).match(/(\w+)\]$/)[1];
    if (m[c] && !m[c](vi[0],str)) {
      fail(item,vi[1]);
      return false;
    }
  }
  succ(item);
  return true;
}

var result={};
for (var k in validator){
	result[k]=false;
}

function fail(item, msg){
	$("#item_"+item+" .ui-message").html(msg).removeClass('onCorrect').addClass('onError');
	result[item]=false;
	disable();
}
function succ(item) {
	$("#item_"+item+" .ui-message").html('填写正确').removeClass('onError').addClass('onCorrect');
	result[item]=true;
	check_all();
}
function check_all() {
	for (var k in result){
	  if (result[k]==false){
	    disable();
	    return true;
	  }
	}
	if (!$('#agree').attr('checked')) {
	  disable();
	  return true;
	}
	enable();
	return true;
}
function enable(){
	$('#submit_enabled').show();
	$('#submit_disabled').hide();
	return true;
}
function disable(){
	$('#submit_enabled').hide();
	$('#submit_disabled').show();
	return false;
}
function check_and_submit() {
	if (!check_all()) {
	return;
	}
	$('form')[0].submit();
}
$(function(){
	$('#regform input').blur(function(){ validate(this.name); }).change(check_all);
});
</script>
</head>
<body>
<div class="layout" id="sign-header">
	<div id="sign-logo">
		<a href="{maccms:path}"><img src="{maccms:path}template/user/images/logo.png" alt=""/></a>
	</div>
</div>
<!-- // sign-header end -->
<div class="layout" id="sign-content">
	<div class="ui-box ui-qire sign-focus" id="reg-box">
		<div class="ui-title fn-clear">
			<span>已有帐号？请<a href="index.php?m=user-login.html">直接登录</a></span>
			<h2>注册{maccms:name}会员</h2>
		</div>
		<div class="ui-cnt fn-clear">
			<form id="regform" action="index.php?m=user-regsave.html" method="post">
				<div class="ui-form" id="sign-primary">
					<div class="ui-form-item fn-clear" >
						<label class="ui-label w100">&nbsp;</label>
						<p class="qire-notice">
							友情提示：注册成功后，请用用户名登录即可！
						</p>
					</div>
					
					
					<div class="ui-form-item fn-clear" id="item_u_name">
						<label for="u_name" class="ui-label w100">用户名：</label><input type="text" id="u_name" name="u_name" class="ui-input w220" value=""/>
						<p class="ui-message onShow" >
							用户名使用4-16个字符
						</p>
					</div>
					<div class="ui-form-item fn-clear" id="item_u_password1">
						<label for="u_password1" class="ui-label w100">设置密码：</label><input type="password" id="u_password1" name="u_password1" maxlength="20" class="ui-input w220" value=""/>
						<p class="ui-message onShow" >
							6-16个字符
						</p>
					</div>
					<div class="ui-form-item fn-clear" id="item_u_password2">
						<label for="u_password2" class="ui-label w100">重复密码：</label><input type="password" id="u_password2" name="u_password2" maxlength="20" class="ui-input w220" value=""/>
						<p class="ui-message onShow" >
							请再一次输入密码
						</p>
					</div>					
					<div class="ui-form-item fn-clear" id="item_u_email">
						<label for="u_email" class="ui-label w100"><strong>Email</strong>地址：</label><input type="text" id="u_email" name="u_email" class="ui-input w220" value=""/>
						<div class="f3"><span></span></div>
						<p class="ui-message onShow" >
							请输入有效的Email地址
						</p>
					</div>
					<div class="ui-form-item fn-clear" id="item_u_code">
						<label for="u_code" class="ui-label w100">验证码：</label>
						<div class="ui-form-block w120">
							<input type="text" id="u_code" name="u_code" maxlength="10" class="ui-input w110" value=""/>				
						</div>
						<img src="{maccms:path}inc/common/code.php?a=userreg&s='Math.random()" title="看不清楚? 换一张！" style="cursor:hand;width: 88px;height: 35px;float: left; isplay: block;overflow: hidden;margin: 0 10px 0 0;vertical-align: top;cursor: pointer;" onClick="src='{maccms:path}inc/common/code.php?a=userreg&s='+Math.random()"/>			
						<p class="ui-message onShow" >
							输入上图运算的答案
						</p>
					</div>
					<div class="ui-form-item ui-form-checkbox fn-clear">
						<label class="ui-label w100">&nbsp;</label>
						<div class="ui-form-block w220">
							<label for="agreement" class="ui-label-checkbox"><input type="checkbox" value="" name="agreement" id="agreement" checked="checked" value='1'/>我已阅读并接受《<a href="#">使用协议</a>》
							</label>
						</div>
					</div>
					<div class="ui-form-item fn-clear">
						<label class="ui-label w100">&nbsp;</label><input type="submit" id="register" class="ui-button w220" value="注册会员"/>
					</div>
				</div>
				<!-- // ui-form#sign-primary end -->
			</form>
			<div id="sign-app">
				<div class="sign-app-list">
					<h5>注册通行证可享会员服务</h5>
					<h5>收费影片</h5>
					<h5>会员影片</h5>
					<h5>特殊影片</h5>
					
					<h5>你还可以用以下方式直接登录：</h5>
					<a href="{maccms:path}index.php?m=user-reg-ref-qqlogin.html"><img src="{maccms:path}template/user/images/qq_login.gif" alt=""/></a>
				</div>
			</div>
			<!-- // sign-app end -->
		</div>
	</div>
	<!-- // sign-box#regbox end -->
</div>
<!-- // sign-content end -->
{foot}
</body>
</html>